//
//  BSLGalleryHelper.h
//  demo
//
//  Created by RYAN on 15/7/13.
//
//

#import <Foundation/Foundation.h>
#import <AssetsLibrary/AssetsLibrary.h>
#import "BSLAsset.h"

#define SCREEN_FRAME ([[BSLGalleryHelper shareInatance] popoverSupported] ? CGRectMake(0, 0, 320, 480) : [UIScreen mainScreen].bounds)

@class CDVInvokedUrlCommand;

@interface BSLGalleryHelper : NSObject

@property (nonatomic, strong) NSString *filter;//选择文件类型过滤器
@property (nonatomic, strong) NSString *fileName;
@property (nonatomic, assign) BOOL isAnimated;
@property (nonatomic, assign) BOOL shouldMultiple;

@property (nonatomic, strong) NSString *fileDirectory;
@property (nonatomic, strong) NSString *fileComponent;
@property (nonatomic, strong) NSString *filePathExtension;
@property (nonatomic, strong) NSDictionary *popoverOptions;

+ (instancetype)shareInatance;

//记录前端传进来的参数
- (void)setPropertyWithCommand:(CDVInvokedUrlCommand *)command;

/**
 *  判断要保存文件的后缀是不是PNG
 *
 *  @return YES:PNG NO:OTHER
 */
- (BOOL)isPNGPathExtension;

/**
 *  获取当前相册要从哪个相簿加载图片
 *
 *  @return 当前选中相簿ALAssetsFilter
 */
- (ALAssetsFilter *)groupFilter;

/**
 *  过滤器名字
 *
 *  @return "相册"对应none，视频对应video，照片对应image
 */
- (NSString *)titleFromFilter;

/**
 *  将选中的照片保存到沙盒中，默认在Library/bsl/下，会根据前端传入的filename在bsl文件夹下新建文件夹或文件
 *
 *  @param assets 选中图片的数组
 *
 *  @return 数组，包含成功保存到沙盒的图片路径
 */
- (NSMutableArray *)saveToLibrary:(NSMutableArray *)assets;

/**
 *  判断当前设备是否可用UIPopoverController，或前端传入的参数是否满足
 *
 *  @return YES：可用
 */
- (BOOL)popoverSupported;//判断UIPopoverController是否有效

/**
 *  返回UIPopoverController的指定位置frame
 *
 *  @return 坐标
 */
- (CGRect)getPoppverControllerFrame;

@end
